<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function exam(date) {
            date = '5.27'
            console.log(date)
        }
        let date = '5.24'
        exam(date);
        console.log(date);//date 会被修改不？

        //函数的传值
        let obj = {
            date: '5.24'
        }
        function changeObj(obj) {
            obj.date = '5.27';
        }
        //changeObj(obj);
        //console.log(obj.date);//会被修改吗？ 

        function changeObj2(obj) {
            obj = {
                date: '5.27',
            }
        }
        changeObj2(obj);
        console.log(obj.date);//会被修改吗？ 


        //不定参数 ...

        function mutilParam(param1, parma2, ...param3) {
            console.log(param1);//1
            console.log(parma2);//
            console.log(param3);
        }

        mutilParam(1, 9, 8, 6, 3, 5, 6);







        //原型对象
        function createObj() {
            //this 此次创建的对象
            this.name = 'javascript';
            window.this1 = this;
            //this.name2='my name is function';
        }


        createObj.prototype.name2 = 'my name is prototype'
        createObj.prototype.func = function (name) {
            console.log(name)
        }

        let obj2 = new createObj();
        window.this2 = obj2
        console.log(obj2);
        console.log(createObj.prototype);
        console.log(obj2.__proto__);
        console.log(obj2.__proto__ === createObj.prototype)

        let obj3 = new createObj();
        console.log(obj2 === obj3);
        console.log(obj2.__proto__ === obj3.__proto__);

        //原型对象的构造器
        console.log(obj2.__proto__.constructor === createObj);
        obj2.__proto__.exam = '5.27 14:00-17:00';
        console.log(obj3.__proto__.exam);
        console.log(obj2.name2);

        //obj 的call
        function greet() {
            let reply = 'reply '+this.animal;
            console.log(reply);
        }

        let obj4 = {
            animal: 'cats123', 
        };

        //
        //new greet();
        greet.call(obj4);  // cats typically sleep between 12 and 16 hours















    </script>
</body>

</html>